package JavaDay51;

public class TenToBinary {

	public static void main(String[] args) {
		String str = trans(10);
		System.out.println(str);
	}
	public static String trans(int num) {
	    if (num == 0) {
	        return "0";
	    }
	    StringBuilder binary = new StringBuilder();
	    int n = num;
	    while (n > 0) {
	        binary.insert(0, n % 2);
	        n = n / 2;
	    }
	    return binary.toString();
	}
}
